/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package test;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.io.Serializable;

/**
 *
 * @author hienpt9
 */
public class OAuthProviderTokenServicesImpl implements Serializable {
    byte[] data = new byte[1024*4];

    public OAuthProviderTokenServicesImpl() {
        for (int i=0; i< data.length; i++) {
            data[i] = (byte) 0xff;
        }
    }
    
     public int getSize() throws IOException {
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        ObjectOutputStream out = new ObjectOutputStream(bos);
        int size =0;
        try {
            out.writeObject(this);
            byte[] tmpBytes = bos.toByteArray();
            size = tmpBytes.length;
        } finally {
            try {
                if (out != null) {
                    out.close();
                }
            } catch (IOException ex) {
                ex.printStackTrace();
            }
            try {
                bos.close();
            } catch (IOException ex) {
                ex.printStackTrace();
            }
        }
        return size;
    }
}
